package Springboot.Controller;


import Springboot.Utils.Result;
import Springboot.domain.NewsHeadline;
import Springboot.service.impl.NewsHeadlineServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("headline")
public class headlineController {
    @Autowired
    private NewsHeadlineServiceImpl newsHeadlineService;
    @PostMapping("publish")
    public Result publish(@RequestBody NewsHeadline newsHeadline,@RequestHeader String token) {
        Result result=newsHeadlineService.publish(newsHeadline,token);
        return result;
    }
    @PostMapping("findHeadlineByHid")
    public Result findHeadlineByHid(Integer hid) {
        Result result=newsHeadlineService.newsHeadlineService(hid);
        return result;
    }
    @PostMapping("update")
    public Result update(@RequestBody NewsHeadline newsHeadline) {
        Result result=newsHeadlineService.update(newsHeadline);
        return result;
    }
    @PostMapping("removeByHid")
    public Result removeByHid(Integer hid) {
        Result result=newsHeadlineService.removeByHid(hid);
        return result;
    }
}
